﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Linq;
using System.Xml.Schema;
using System.Xml.XPath;
using System.Xml.Xsl;

namespace Rdz.Xml
{
	public class XMLUtility
	{
		/// <summary>
		/// Get Attribute Value from First Node of Xml Object
		/// </summary>
		/// <param name="XmlText">Xml in string</param>
		/// <param name="NodeIndex">Node index to return</param>
		/// <param name="AttributeName">Attribute name to return</param>
		/// <returns></returns>
		public static string FindAttributeValueFromChildNodes(string XmlText, int NodeIndex, string AttributeName)
		{
			XmlDocument XmlDoc = new XmlDocument();
			XmlDoc.LoadXml(XmlText);
			return XmlDoc.ChildNodes[NodeIndex].Attributes[AttributeName].Value;
		}
	}
}
